home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / include / intuition / gadgetclass.h next >
C/C++ Source or Header  |  1996-10-31  |  10KB  |  301 lines

  1. #ifndef INTUITION_GADGETCLASS_H
  2. #define INTUITION_GADGETCLASS_H
  3.  
  4. /*
  5.     (C) 1995-96 AROS - The Amiga Replacement OS
  6.     $Id: gadgetclass.h,v 1.2 1996/10/31 12:21:55 aros Exp $
  7.  
  8.     Desc: Headerfile for Intuitions' GadgetClass and ButtonGClass
  9.     Lang: english
  10. */
  11. #ifndef EXEC_TYPES_H
  12. #   include <exec/types.h>
  13. #endif
  14. #ifndef INTUITION_INTUITION_H
  15. #   include <intuition/intuition.h>
  16. #endif
  17. #ifndef UTILITY_TAGITEM_H
  18. #   include <utility/tagitem.h>
  19. #endif
  20.  
  21. #ifdef _AMIGA
  22. #   define STCKWORD    WORD
  23. #   define STCKULONG    ULONG
  24. #   define STCKLONG    LONG
  25. #else
  26. #   define STCKWORD    int
  27. #   define STCKULONG    unsigned long
  28. #   define STCKLONG    long
  29. #endif
  30.  
  31. /* GadgetClass attributes */
  32. #define GA_Dummy        (TAG_USER + 0x30000)
  33. #define GA_Left         (GA_Dummy +  1) /* (LONG) Left edge */
  34. #define GA_RelRight        (GA_Dummy +  2) /* (LONG) Left=Win->Width-this-1 */
  35. #define GA_Top            (GA_Dummy +  3) /* (LONG) Top edge */
  36. #define GA_RelBottom        (GA_Dummy +  4) /* (LONG) Top=Win->Height-this-1 */
  37. #define GA_Width        (GA_Dummy +  5) /* (LONG) Width */
  38. #define GA_RelWidth        (GA_Dummy +  6) /* (LONG) Width=Win->Width-this */
  39. #define GA_Height        (GA_Dummy +  7) /* (LONG) Height */
  40. #define GA_RelHeight        (GA_Dummy +  8)
  41. #define GA_Text         (GA_Dummy +  9) /* (UBYTE *) */
  42. #define GA_Image        (GA_Dummy + 10)
  43. #define GA_Border        (GA_Dummy + 11)
  44. #define GA_SelectRender     (GA_Dummy + 12)
  45. #define GA_Highlight        (GA_Dummy + 13)
  46. #define GA_Disabled        (GA_Dummy + 14)
  47. #define GA_GZZGadget        (GA_Dummy + 15)
  48. #define GA_ID            (GA_Dummy + 16)
  49. #define GA_UserData        (GA_Dummy + 17)
  50. #define GA_SpecialInfo        (GA_Dummy + 18)
  51. #define GA_Selected        (GA_Dummy + 19)
  52. #define GA_EndGadget        (GA_Dummy + 20)
  53. #define GA_Immediate        (GA_Dummy + 21)
  54. #define GA_RelVerify        (GA_Dummy + 22)
  55. #define GA_FollowMouse        (GA_Dummy + 23)
  56. #define GA_RightBorder        (GA_Dummy + 24)
  57. #define GA_LeftBorder        (GA_Dummy + 25)
  58. #define GA_TopBorder        (GA_Dummy + 26)
  59. #define GA_BottomBorder     (GA_Dummy + 27)
  60. #define GA_ToggleSelect     (GA_Dummy + 28)
  61. #define GA_SysGadget        (GA_Dummy + 29) /* internal */
  62. #define GA_SysGType        (GA_Dummy + 30) /* internal */
  63. #define GA_Previous        (GA_Dummy + 31) /* Previous Gadget [I.G] */
  64. #define GA_Next         (GA_Dummy + 32)
  65. #define GA_DrawInfo        (GA_Dummy + 33) /* Some Gadgets need this */
  66.  
  67. /* You should use at most ONE of GA_Text, GA_IntuiText, and GA_LabelImage */
  68. #define GA_IntuiText        (GA_Dummy + 34) /* ti_Data is (struct IntuiText *) */
  69. #define GA_LabelImage        (GA_Dummy + 35) /* ti_Data is an image (object) */
  70.  
  71. #define GA_TabCycle        (GA_Dummy + 36) /* BOOL: Handle Tab/Shift-Tab */
  72. #define GA_GadgetHelp        (GA_Dummy + 37) /* Send GADGETHELP message */
  73. #define GA_Bounds        (GA_Dummy + 38) /* struct IBox * */
  74. #define GA_RelSpecial        (GA_Dummy + 39) /* Special handling in GM_LAYOUT */
  75. #define GA_TextAttr        (GA_Dummy + 40) /* (struct TextAttr *) */
  76. #define GA_ReadOnly        (GA_Dummy + 41) /* (BOOL) */
  77.  
  78.  
  79. /* PROPGCLASS attributes */
  80. #define PGA_Dummy        (TAG_USER + 0x31000)
  81. #define PGA_Freedom        (PGA_Dummy +  1) /* only one of FREEVERT or FREEHORIZ */
  82. #define PGA_Borderless        (PGA_Dummy +  2)
  83. #define PGA_HorizPot        (PGA_Dummy +  3)
  84. #define PGA_HorizBody        (PGA_Dummy +  4)
  85. #define PGA_VertPot        (PGA_Dummy +  5)
  86. #define PGA_VertBody        (PGA_Dummy +  6)
  87. #define PGA_Total        (PGA_Dummy +  7)
  88. #define PGA_Visible        (PGA_Dummy +  8)
  89. #define PGA_Top         (PGA_Dummy +  9)
  90. #define PGA_NewLook        (PGA_Dummy + 10)
  91.  
  92. /* STRGCLASS attributes */
  93. #define STRINGA_Dummy        (TAG_USER      +0x32000)
  94. #define STRINGA_MaxChars    (STRINGA_Dummy +  1)
  95. #define STRINGA_Buffer        (STRINGA_Dummy +  2)
  96. #define STRINGA_UndoBuffer  (STRINGA_Dummy +  3)
  97. #define STRINGA_WorkBuffer  (STRINGA_Dummy +  4)
  98. #define STRINGA_BufferPos   (STRINGA_Dummy +  5)
  99. #define STRINGA_DispPos     (STRINGA_Dummy +  6)
  100. #define STRINGA_AltKeyMap   (STRINGA_Dummy +  7)
  101. #define STRINGA_Font        (STRINGA_Dummy +  8)
  102. #define STRINGA_Pens        (STRINGA_Dummy +  9)
  103. #define STRINGA_ActivePens  (STRINGA_Dummy + 10)
  104. #define STRINGA_EditHook    (STRINGA_Dummy + 11)
  105. #define STRINGA_EditModes   (STRINGA_Dummy + 12)
  106.  
  107. /* booleans */
  108. #define STRINGA_ReplaceMode    (STRINGA_Dummy + 13)
  109. #define STRINGA_FixedFieldMode    (STRINGA_Dummy + 14)
  110. #define STRINGA_NoFilterMode    (STRINGA_Dummy + 15)
  111. #define STRINGA_Justification    (STRINGA_Dummy + 16) /* GACT_STRINGCENTER,
  112.                             GACT_STRINGLEFT,
  113.                             GACT_STRINGRIGHT */
  114. #define STRINGA_LongVal     (STRINGA_Dummy + 17)
  115. #define STRINGA_TextVal     (STRINGA_Dummy + 18)
  116. #define STRINGA_ExitHelp    (STRINGA_Dummy + 19) /* Exit on "Help" */
  117.  
  118. #define SG_DEFAULTMAXCHARS    (128)
  119.  
  120. /* Gadget Layout related attributes    */
  121. #define LAYOUTA_Dummy        (TAG_USER  + 0x38000)
  122. #define LAYOUTA_LayoutObj    (LAYOUTA_Dummy + 1)
  123. #define LAYOUTA_Spacing     (LAYOUTA_Dummy + 2)
  124. #define LAYOUTA_Orientation    (LAYOUTA_Dummy + 3)
  125. #define LAYOUTA_ChildMaxWidth    (LAYOUTA_Dummy + 4)
  126. #define LAYOUTA_ChildMaxHeight    (LAYOUTA_Dummy + 5)
  127.  
  128. /* orientation values    */
  129. #define LORIENT_NONE    0
  130. #define LORIENT_HORIZ    1
  131. #define LORIENT_VERT    2
  132.  
  133.  
  134. /* Gadget Method ID's   */
  135. #define GM_HITTEST    (0)     /* return GMR_GADGETHIT if you are hit
  136.                    (works in disabled state, too). */
  137. #define GM_RENDER    (1)     /* draw yourself in the right state */
  138. #define GM_GOACTIVE    (2)     /* You will receive input */
  139. #define GM_HANDLEINPUT    (3)     /* handle input */
  140. #define GM_GOINACTIVE    (4)     /* no more input */
  141. #define GM_HELPTEST    (5)     /* Will you send gadget help if the mouse is
  142.                    at the specified coordinates?  See below
  143.                    for possible GMR_ values. */
  144. #define GM_LAYOUT    (6)     /* re-evaluate your size based on the GadgetInfo
  145.                    Domain. Do NOT re-render yourself yet, you
  146.                    will be called when it is time... */
  147. #define GM_DOMAIN    (7)     /* Query the sizing requirements */
  148.  
  149. /* Parameter "Messages" passed to gadget class methods  */
  150.  
  151. /* GM_HITTEST and GM_HELPTEST send this message.
  152.  * For GM_HITTEST, gpht_Mouse are coordinates relative to the gadget
  153.  * select box.    For GM_HELPTEST, the coordinates are relative to
  154.  * the gadget bounding box (which defaults to the select box).
  155.  */
  156. struct gpHitTest
  157. {
  158.     ULONG        MethodID;
  159.     struct GadgetInfo  *gpht_GInfo;
  160.     struct
  161.     {
  162.     STCKWORD X;
  163.     STCKWORD Y;
  164.     }            gpht_Mouse;
  165. };
  166.  
  167. /* For GM_HITTEST, return GMR_GADGETHIT if you were indeed hit,
  168.  * otherwise return zero.
  169.  *
  170.  * For GM_HELPTEST, return GMR_NOHELPHIT (zero) if you were not hit.
  171.  * Typically, return GMR_HELPHIT if you were hit.
  172.  * It is possible to pass a UWORD to the application via the Code field
  173.  * of the IDCMP_GADGETHELP message.  Return GMR_HELPCODE or'd with
  174.  * the UWORD-sized result you wish to return.
  175.  *
  176.  * GMR_HELPHIT yields a Code value of ((UWORD) ~0), which should
  177.  * mean "nothing particular" to the application.
  178.  */
  179.  
  180. #define GMR_GADGETHIT    (0x00000004)    /* GM_HITTEST hit */
  181.  
  182. #define GMR_NOHELPHIT    (0x00000000)    /* GM_HELPTEST didn't hit */
  183. #define GMR_HELPHIT    (0xFFFFFFFF)    /* GM_HELPTEST hit, return code = ~0 */
  184. #define GMR_HELPCODE    (0x00010000)    /* GM_HELPTEST hit, return low word as code */
  185.  
  186. /* GM_RENDER    */
  187. struct gpRender
  188. {
  189.     ULONG        MethodID;
  190.     struct GadgetInfo  *gpr_GInfo;    /* gadget context        */
  191.     struct RastPort    *gpr_RPort;    /* all ready for use        */
  192. #ifdef _AMIGA
  193.     LONG        gpr_Redraw;    /* might be a "highlight pass"  */
  194. #else
  195.     int         gpr_Redraw;    /* might be a "highlight pass"  */
  196. #endif
  197. };
  198.  
  199. /* values of gpr_Redraw */
  200. #define GREDRAW_UPDATE    (2)     /* incremental update, e.g. prop slider */
  201. #define GREDRAW_REDRAW    (1)     /* redraw gadget        */
  202. #define GREDRAW_TOGGLE    (0)     /* toggle highlight, if applicable      */
  203.  
  204. /* GM_GOACTIVE, GM_HANDLEINPUT    */
  205. struct gpInput
  206. {
  207.     ULONG        MethodID;
  208.     struct GadgetInfo  *gpi_GInfo;
  209.     struct InputEvent  *gpi_IEvent;
  210.     LONG           *gpi_Termination;
  211.     struct
  212.     {
  213.     STCKWORD X;
  214.     STCKWORD Y;
  215.     }            gpi_Mouse;
  216.  
  217.     /* (V39) Pointer to TabletData structure, if this event originated
  218.      * from a tablet which sends IESUBCLASS_NEWTABLET events, or NULL if
  219.      * not.
  220.      *
  221.      * DO NOT ATTEMPT TO READ THIS FIELD UNDER INTUITION PRIOR TO V39!
  222.      * IT WILL BE INVALID!
  223.      */
  224.     struct TabletData  *gpi_TabletData;
  225. };
  226.  
  227. /* GM_HANDLEINPUT and GM_GOACTIVE  return code flags    */
  228. /* return GMR_MEACTIVE (0) alone if you want more input.
  229.    Otherwise, return ONE of GMR_NOREUSE and GMR_REUSE, and optionally
  230.    GMR_VERIFY.
  231. */
  232. #define GMR_MEACTIVE    (0)
  233. #define GMR_NOREUSE    (1 << 1)
  234. #define GMR_REUSE    (1 << 2)
  235. #define GMR_VERIFY    (1 << 3)        /* you MUST set gpi_Termination */
  236.  
  237. /*
  238.     You can end activation with one of GMR_NEXTACTIVE and GMR_PREVACTIVE,
  239.     which instructs Intuition to activate the next or previous gadget
  240.     that has GFLG_TABCYCLE set.
  241. */
  242. #define GMR_NEXTACTIVE    (1 << 4)
  243. #define GMR_PREVACTIVE    (1 << 5)
  244.  
  245. /* GM_GOINACTIVE */
  246. struct gpGoInactive
  247. {
  248.     ULONG        MethodID;
  249.     struct GadgetInfo  *gpgi_GInfo;
  250.  
  251.     /* V37 field only!    DO NOT attempt to read under V36! */
  252.     STCKULONG        gpgi_Abort;    /* gpgi_Abort=1 if gadget was aborted
  253.                      * by Intuition and 0 if gadget went
  254.                      * inactive at its own request
  255.                      */
  256. };
  257.  
  258.  
  259. /* New for V39: Intuition sends GM_LAYOUT to any GREL_ gadget when
  260.  * the gadget is added to the window (or when the window opens, if
  261.  * the gadget was part of the NewWindow.FirstGadget or the WA_Gadgets
  262.  * list), or when the window is resized.  Your gadget can set the
  263.  * GA_RelSpecial property to get GM_LAYOUT events without Intuition
  264.  * changing the interpretation of your gadget select box.  This
  265.  * allows for completely arbitrary resizing/repositioning based on
  266.  * window size.
  267.  */
  268. /* GM_LAYOUT */
  269. struct gpLayout
  270. {
  271.     ULONG        MethodID;
  272.     struct GadgetInfo  *gpl_GInfo;
  273.     STCKULONG        gpl_Initial;    /* non-zero if this method was invoked
  274.                      * during AddGList() or OpenWindow()
  275.                      * time.  zero if this method was invoked
  276.                      * during window resizing.
  277.                      */
  278. };
  279.  
  280.  
  281. /*
  282.     The GM_DOMAIN method is used to obtain the sizing requirements of an
  283.     object for a class before ever creating an object.
  284. */
  285. /* GM_DOMAIN */
  286. struct gpDomain
  287. {
  288.     ULONG         MethodID;
  289.     struct GadgetInfo    *gpd_GInfo;
  290.     struct RastPort    *gpd_RPort;    /* RastPort to layout for */
  291.     STCKLONG         gpd_Which;
  292.     struct IBox      gpd_Domain;    /* Resulting domain */
  293.     struct TagItem    *gpd_Attrs;    /* Additional attributes */
  294. };
  295.  
  296. #define GDOMAIN_MINIMUM     (0) /* Minimum size */
  297. #define GDOMAIN_NOMINAL     (1) /* Nominal size */
  298. #define GDOMAIN_MAXIMUM     (2) /* Maximum size */
  299.  
  300. #endif /* INTUITION_GADGETCLASS_H */
  301.